<?php
header('Content-Type: application/xhtml+xml; charset=UTF-8');
?>


<database>
	<version><?=$version?></version>
	<packages>
	<?php if (count($packages) != 0): ?>
	<?php foreach($packages as $p):?>
    
		<entry>
			<string><?=$p['pkg_id']?></string>
			<package>
				<pkgid><?=$p['pkg_id']?></pkgid>
				<name><?=$p['pkg_name']?></name>
				<website><?=$p['website']?></website>
				<respusr><?=$p['resp_usr']?></respusr>
				<licence><?=$p['licence']?></licence>
				<category><?=$p['category']?></category>
				<shortdesc><?=$p['short_desc']?></shortdesc>
				<creationdate><?=$p['pkg_creation']?></creationdate>
				<lastupdate><?=$p['pkg_last_up']?></lastupdate>
				<status><?=$p['pkg_status']?></status>
				<branches>
				
				<?php foreach($p['branches'] as $b):?>
				<?php if (count($b) != 0): ?>
					<entry>
						<string><?=$b['branch_id']?></string>
						<branch>
					  		<branchid><?=$b['branch_id']?></branchid>
							<name><?=$b['bch_name']?></name>
							<pck><?=$b['package']?></pck>
							<creationdate><?=$b['bch_creation']?></creationdate>
							<lastupdate><?=$b['bch_last_up']?></lastupdate>
							<description><?=$b['description']?></description>
							<status><?=$b['bch_status']?></status>
							<releases>
		
							<?php foreach($b['releases'] as $r):?>
							<?php if (count($r) != 0): ?>
		
								<entry>
				  					<string><?=$r['rls_id']?></string>
				  					<release>
				    					<rlsid><?=$r['rls_id']?></rlsid>
				    					<version><?=$r['version']?></version>
				    					<branch><?=$r['branch']?></branch>
				    					<lastupdate><?=$r['rls_last_up']?></lastupdate>
									    <releasenote><?=$r['release_note']?></releasenote>
									    <rlshash><?=$r['rlshash']?></rlshash>
									    <status><?=$r['rls_status']?></status>
									    <state><?=$r['type']?></state>
									 </release>
								</entry>
							
							<?php endif;?>
							<?php endforeach;?>
		
							</releases>
		
						</branch>
					</entry>
	
				<?php endif;?>
				<?php endforeach;?>
	
				</branches>
			</package>
		</entry>
    
    <?php endforeach;?>
    <?php endif;?>
	</packages>
</database>

